package top.wangjiu.java.jvm.attribute.annotation;

import top.wangjiu.java.jvm.AttributeInfo;
import top.wangjiu.java.jvm.attribute.annotation.info.AnnotationInfo;
import top.wangjiu.java.jvm.constantinfo.ConstantPoolInfo;

public class RuntimeVisibleAnnotationsAttr  extends AttributeInfo {

    public final static String NAME = "RuntimeVisibleAnnotations";

    private final short attributeNameIndex;   //常量池中的uft8类型的索引，值固定为”Code“
    private final int attributeLength;       //属性长度 为整个属性表长度

    private final short numAnnotations;
    private AnnotationInfo[] annotations;

    public RuntimeVisibleAnnotationsAttr(short attributeNameIndex,int attributeLength,AnnotationInfo[] annotations){
        this.attributeNameIndex = attributeNameIndex;
        this.attributeLength = attributeLength;
        this.numAnnotations = (short) annotations.length;
        this.annotations = annotations;
    }

    @Override
    public short attributeNameIndex() {
        return attributeNameIndex;
    }

    @Override
    public int attributeLength() {
        return attributeLength;
    }

    @Override
    public String toString(ConstantPoolInfo[] poolInfos) {
        return null;
    }
}
